package org.dizem.groupon.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.dizem.groupon.service.UserService;

import java.util.Map;

/**
 * @author: dizem
 * @date: 11-6-29
 */
public class ValidateEmailAction extends ActionSupport {
	private String username;
	private String uid;
	private UserService service;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public UserService getService() {
		return service;
	}

	public void setService(UserService service) {
		this.service = service;
	}

	@Override
	public String execute() throws Exception {
		Map session = ActionContext.getContext().getSession();
		if (service.checkAuthCode(username, uid)) {
			session.put("message", username+ "邮箱验证成功");
		} else {
			session.put("message", "邮箱验证错误");
		}
		return super.execute();
	}
}
